﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Administrator_AdminControl_supportOnline : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void btnsave_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtPhoneStyle.Text != "" || txtnickname.Text != "")
            {
                using (Up1VNDataContext dc = new Up1VNDataContext())
                {
                    SupportOnline SP = new SupportOnline();
                    if (txtPhoneStyle.Text != "")
                    {
                        SP.SupportOnline_PhoneNo = txtPhoneStyle.Text;
                        SP.SupportOnline_PhoneType = byte.Parse(ddlPhone.SelectedValue.ToString());
                    }
                    if (txtnickname.Text != "")
                    {
                        SP.SupportOnline_Nick = txtnickname.Text;
                        SP.SupportOnline_NickType = byte.Parse(ddlnickname.SelectedValue.ToString());
                    }
                    dc.SupportOnlines.InsertOnSubmit(SP);
                    dc.SubmitChanges();
                    lblmsg.Text = "Thông tin đã được lưu.";
                }
            }
            else
                lblmsg.Text = "Không được bỏ trống.";
        }
        catch (Exception)
        {
        }
    }
}